package sy2;

public class demo1 {
        public static void main(String[] args) {
            Phone one = new Phone();
            System.out.println(one.brand); // null
            System.out.println(one.price); //0.0
            System.out.println(one.color); //null
            System.out.println("=========");

            one.brand = "苹果";
            one.price = 8388.0;
            one.color = "黑色";
            System.out.println(one.brand); //苹果
            System.out.println(one.price); // 8388.0
            System.out.println(one.color); //黑色
            System.out.println("=========");

            one.call("乔布斯"); // 给乔布斯打电话
            one.sendMessage(); // 群发短信
            System.out.println("=========");

            // 将one当中保存的对象地址值赋值给two
            Phone two = one;
            System.out.println(two.brand); //苹果
            System.out.println(two.price); //8388.0
            System.out.println(two.color); //黑色
            System.out.println("=========");

            two.brand = "华为";
            two.price = 5999.0;
            two.color = "蓝色";
            System.out.println(two.brand); //华为
            System.out.println(two.price); // 5999.0
            System.out.println(two.color); // 蓝色
            System.out.println("=========");

            System.out.println(one.brand); //华为
            System.out.println(one.price); //5999.0
            System.out.println(one.color); //蓝色
            System.out.println("=========");


            two.call("欧巴"); //给欧巴打电话
            two.sendMessage(); // 群发短信

            method(one); // 传递进去的参数其实就是地址值

            Phone three = getPhone();
            System.out.println(three.brand); //荣耀
            System.out.println(three.price); //9000.0
            System.out.println(three.color); //玫瑰金
        }
        public static void method(Phone param) {
            System.out.println(param.brand); //华为
            System.out.println(param.price); // 5999.0
            System.out.println(param.color); //蓝色
        }
        public static Phone getPhone() {
            Phone one = new Phone();
            one.brand = "荣耀";
            one.price = 9000.0;
            one.color = "玫瑰金";
            return one;
        }
    }

